<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <script src="js/swiper-4.2.6.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="css/swiper-4.2.6.min.css"/>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="js/public.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/font.js"></script>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/ui.css">
    <title></title>
    <!-- 订单管理 -->
    <style>
    .main{
        display: none;
    }
    .main.selected{
        display: block;
    }
    </style>
</head>
<body>
<div class="scroll-content3 order-management" style="overflow:auto;background: #f1f1f1;">
    <div class="top-public">
        <span class="public-center">订单管理</span>        
        <img src="images/left_icon.png" alt="" class="public-left">
    </div>
    <ul class="tab-bar">
        <li class="on_"><span>系统订单</span></li>
        <li><span>运营订单</span></li>
        <li><span>推广订单</span></li>
    </ul>
    <ul class="state-bar">
        <li>订单类型</li>
        <li>支付状态</li>
        <li>下单时间</li>
    </ul>
    <div class="drap-down">
        <ul class="type">
            <li class="active" id="0">全部类型</li>
            <li id="1">新购</li>
            <li id="2">续费</li>
        </ul>
        <ul class="status">
            <li class="active" id="0">全部状态</li>
            <li id="1">已支付</li>
            <li id="2">未支付</li>
            <li id="3">作废</li>
        </ul>
        <ul class="time">
            <li class="active" id="0">全部时间</li>
            <li id="1">3个月内</li>
            <li id="2">
                <!--3个月~6个月内-->
                6个月内
            </li>
            <li id="3">一年前</li>
        </ul>
    </div>
    <div class="center-content">
        <!-- 系统订单 -->
        <div class="main selected system">
            <!--<div class="unpaid-order">-->
                <!--您有1个未支付的邦伲德订单-->
            <!--</div>-->
            <div id="systemOrder" class="order-list-box">
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state">作废</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 新购</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state" style="background:#615FD6;">已支付</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 续费</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state" style="background:#615FD6;">已支付</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 续费</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state" style="background:#f00;">未支付</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 升级</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div> -->
            </div>
        </div>
        <!-- 运营订单 -->
        <div class="main operate">
            <div class="unpaid-order">
                <!--您有1个未支付的邦伲德订单-->
                您 暂 无 运 营 订 单！
            </div>
            <!--<div class="order-list-box">-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state">作废</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 新购</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state" style="background:#615FD6;">已支付</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 续费</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state" style="background:#615FD6;">已支付</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 续费</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state" style="background:#f00;">未支付</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 升级</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
            <!--</div>-->
        </div>
        <!-- 推广订单 -->
        <div class="main extend">
            <div class="unpaid-order">
                <!--您有1个未支付的邦伲德订单-->
                您 暂 无 推 广 订 单 !
            </div>
            <!--<div class="order-list-box">-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state">作废</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 新购</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state" style="background:#615FD6;">已支付</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 续费</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state" style="background:#615FD6;">已支付</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 续费</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
                <!--<div class="order-list">-->
                    <!--<div class="list-top">-->
                        <!--<span class="name">展示类网站</span>-->
                        <!--<span class="state" style="background:#f00;">未支付</span>-->
                    <!--</div>-->
                    <!--<div class="list-center">-->
                        <!--<span class="price">￥100000.00</span>-->
                        <!--<span class="type">| 升级</span>-->
                    <!--</div>-->
                    <!--<div class="list-bot">下单时间：<span>2018-09-11 14:54:32</span></div>-->
                    <!--<img src="images/confirm-more.png" alt="" class="more" onclick="more()">-->
                <!--</div>-->
            <!--</div>-->
        </div>
    </div>
    <div class="more-bot">
        <ul>
            <li onclick="payTwo()">支付</li>
            <li class="active" onclick="zuofei()">作废</li>
        </ul>
        <div class="close" onclick="closewin()">取消</div>
    </div>
    <div class="opacity-gray"></div>
</div>
</body>
<script>
//订单支付
function payTwo()
{
    $('.more-bot').hide();
    $('.opacity-gray').hide();
    var user_id = sessionStorage.getItem('userId');
    var payOrderId = sessionStorage.getItem('payOrderId');
    $.ajax({
        url: url() + 'api/order/twoPay', //请求的url地址
        dataType: "JSON", //返回格式为json
        async: true, //请求是否异步，默认为异步，这也是ajax重要特性
        type: "POST", //请求方式
        data: {
            order_id:payOrderId,
            user_id:user_id,
        },
        success: function (data) {
            // console.log(data.order.order_amount)
            //请求成功时处理
            if(data.status == 1){
                var total_fee = data.order.order_amount;
                window.location.href = `http://vip.bndvip.com/api/Pay/wxPay?out_trade_no=${data.order.order_sn}&total_fee=${total_fee}`;
            } else {
                window.location.href=`http://vip.bndvip.com/api/Pay/balancePay?out_trade_no2=${data.order.order_sn}`;
            }
        }
    });

}
//订单作废
function zuofei()
{
    $('.more-bot').hide();
    $('.opacity-gray').hide();
    var payOrderId = sessionStorage.getItem('payOrderId');
    var user_id = sessionStorage.getItem('userId');
    $.ajax({
        url: url() + 'api/order/orderWaste', //请求的url地址
        dataType: "JSON", //返回格式为json
        async: true, //请求是否异步，默认为异步，这也是ajax重要特性
        type: "POST", //请求方式
        data: {
            order_id:payOrderId,
            user_id:user_id,
        },
        success: function (data) {
            //请求成功时处理
            if(data.status == 1){
                alert(data.msg);
                window.location.href = 'orderManagement.html';
            } else {
                console.log(data.msg);
            }
        }
    });
}
$('.public-left').click(function(){
    // window.history.go(-1);
    window.location.href = 'my.html';
});
$('.tab-bar li').click(function () {
    $('.tab-bar li').removeClass('on_');
    $(this).addClass('on_').siblings().removeClass('on_');
    $(".main").eq($(this).index()).show().siblings().hide();
});
function more(id){
    $('.opacity-gray').css('z-index','15');
    $('.more-bot').show();
    $('.opacity-gray').show();
    sessionStorage.setItem('payOrderId',id);
}
function closewin(){
    $('.more-bot').hide();
    $('.opacity-gray').hide();
}
$('.state-bar li').click(function () {
    var boxs = $(".drap-down").children("ul");
    $('.opacity-gray').css('z-index','6');

    if($('.state-bar li').hasClass('on_2')){
        $('.state-bar li').removeClass('on_2');
    }else{
        $('.state-bar li').removeClass('on_2');
        $(this).addClass('on_2').siblings().removeClass('on_2');
        boxs.eq($(this).index()).css("display","block").siblings().css("display","none");
    }
    $('.drap-down').slideToggle(300);
    $('.opacity-gray').toggle();
});
$('.drap-down ul li').click(function () {
        $(this).addClass('active').siblings().removeClass('active');
        $('.drap-down').slideToggle(300);
        $('.opacity-gray').toggle();

    var orderType = $('.drap-down .type .active')[0].id;
    var orderStatus = $('.drap-down .status .active')[0].id;
    var addTime = $('.drap-down .time .active')[0].id;
    var user_id = sessionStorage.getItem('userId');
    $.ajax({
        url: url() + 'api/order/orderList', //请求的url地址
        dataType: "JSON",   //返回格式为json
        async: true,//请求是否异步，默认为异步，这也是ajax重要特性
        type: "POST",   //请求方式
        data:{
            user_id:user_id,
            order_type:orderType,
            order_status:orderStatus,
            add_time:addTime,
        },
        success: function (data) {
            // console.log(data);
            //请求成功时处理
            var html1 = '';
            if(data.status==1){
                $.each(data.result, function (i, item) {
                    $.each(item.goods_list, function (i, item2) {
                        html1 += '<div class="order-list">';
                        html1 += '<div class="list-top">';
                        html1 += '<span class="name">' + item2.goods_name + '</span>';
                        if (item.order_status == 5) {
                            html1 += '<span class="state">作废</span>';
                        } else {
                            if (item.pay_status == 0) {
                                html1 += '<span class="state" style="background:#f00;">未支付</span>';
                            } if (item.pay_status == 1) {
                                html1 += '<span class="state" style="background:#615FD6;">已支付</span>';
                            }
                        }
                        html1 += '</div>';
                        html1 += '<div class="list-center">';
                        html1 += '<span class="price">￥'+item.total_amount+'</span>';
                        html1 += '<span class="type">| '+item.order_type+'</span>';
                        html1 += '</div>';
                        html1 += '<div class="list-bot">下单时间：<span>'+item.add_time+'</span></div>';
                        if (item.pay_status == 0 && item.order_status != 5) {
                            html1 += '<img src="images/confirm-more.png" alt="" class="more" onclick="more('+item.order_id+')">';
                        }
                        html1 += '</div>';
                    });
                });
                $('#systemOrder').html(html1);
            } else {
                html1 += '<div class="order-list">';
                html1 += '<p><b> 暂无数据</b></p>';
                html1 += '</div>';
                $('#systemOrder').html(html1);
                console.log(data.msg);
            }
        }
    });
})
</script>

<script>
    $(function() {
        sessionStorage.removeItem('payOrderId');
        //获取系统订单
        systemOrder();
    });

    //获取系统订单
    function systemOrder() {
        var user_id = sessionStorage.getItem('userId');

        $.ajax({
            url: url() + 'api/order/orderList', //请求的url地址
            dataType: "JSON",   //返回格式为json
            async: true,//请求是否异步，默认为异步，这也是ajax重要特性
            type: "POST",   //请求方式
            data:{
                user_id:user_id,
                order_type:0,
                order_status:0,
                add_time:0,
            },
            success: function (data) {
                // console.log(data.result);
                //请求成功时处理
                var html1 = '';
                if(data.status==1){
                    $.each(data.result, function (i, item) {
                        $.each(item.goods_list, function (i, item2) {
                            html1 += '<div class="order-list">';
                            html1 += '<div class="list-top">';
                            html1 += '<span class="name">' + item2.goods_name + '</span>';
                            if (item.order_status == 5) {
                                html1 += '<span class="state">作废</span>';
                            } else {
                                if (item.pay_status == 0) {
                                    html1 += '<span class="state" style="background:#f00;">未支付</span>';
                                } if (item.pay_status == 1) {
                                    html1 += '<span class="state" style="background:#615FD6;">已支付</span>';
                                }
                            }
                            html1 += '</div>';
                            html1 += '<div class="list-center">';
                            html1 += '<span class="price">￥'+item.total_amount+'</span>';
                            html1 += '<span class="type">|'+item.order_type+'</span>';
                            html1 += '</div>';
                            html1 += '<div class="list-bot">下单时间：<span>'+item.add_time+'</span></div>';
                            if (item.pay_status == 0 && item.order_status != 5) {
                                html1 += '<img src="images/confirm-more.png" alt="" class="more" onclick="more('+item.order_id+')">';
                            }
                            html1 += '</div>';
                        });
                    });
                    $('#systemOrder').html(html1);
                } else {
                    html1 += '<div class="order-list">';
                    html1 += '<p><b> 暂无数据</b></p>';
                    html1 += '</div>';
                    $('#systemOrder').html(html1);
                    console.log(data.msg);
                }
            }
        });
    }
</script>
</html> 






